﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板

namespace XiaoweiUWP.HpControls
{
    public sealed partial class SliderButton : UserControl
    {
        public event Action Click;
        public SliderButton()
        {
            this.InitializeComponent();
            this.Loaded += SliderButton_Loaded;
        }
        private Brush OldBrush;
        private void SliderButton_Loaded(object sender, RoutedEventArgs e)
        {
            OldBrush = BtnBorder.BorderBrush;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Click?.Invoke();
        }


        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(SliderButton), new PropertyMetadata(0));

        private void p_entered(object sender, PointerRoutedEventArgs e)
        {
            //#50A5FB
            BtnBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 80, 165, 251));
        }

        private void p_exit(object sender, PointerRoutedEventArgs e)
        {
            BtnBorder.BorderBrush = OldBrush;
        }
    }
}
